#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<pair<int, int>> edges;
int qpow(int x, int p) {
    int res = 1;
    while (p) {
        if (p & 1) {
            res = 1ll * res * x % MOD;
        }
        x = 1ll * x * x % MOD;
        p >>= 1;
    }
    return res;
}
namespace s1 {
const int N = 16;
bool flg[1 << N];
int f[N][1 << N];
void solve(int n, int m) {
    for (int S = 1; S < (1 << n); S++) {
        bool f = 1;
        for (pair<int, int> e : edges) {
            if (((S >> (e.first - 1)) & 1) && ((S >> (e.second - 1)) & 1)) {
                f = 0;
                break;
            }
        }
        flg[S] = f;
    }
    f[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int S = 0; S < (1 << n); S++) {
            for (int S1 = S; S1; S1 = (S1 - 1) & S) {
                if (flg[S1]) {
                    f[i][S] = (f[i][S] + f[i - 1][S ^ S1]) % MOD;
                }
            }
        }
    }
}
int C(int n, int m) {
    int res = 1;
    int r1 = 1;
    for (int i = n; i >= n - m + 1; i--) {
        res = 1ll * res * i % MOD;
    }
    for (int i = 1; i <= m; i++) {
        r1 = 1ll * r1 * i % MOD;
    }
    r1 = qpow(r1, MOD - 2);
    return 1ll * r1 * res % MOD;
}
int calc(int n, int k) {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = (ans + 1ll * f[i][(1 << n) - 1] * C(k, i) % MOD) % MOD;
    }
    return ans;
}
}  // namespace s1
namespace s2 {
const int N = 1e5 + 10;
const int N2 = 48;
int nums[N2], ncnt;
bool vis[N];
int dep[N];
vector<int> bian[N];
vector<pair<int, int>> ebuf;
void dfs(int x, int fa) {
    vis[x] = 1;
    dep[x] = dep[fa] + 1;
    for (int v : bian[x]) {
        if (!vis[v]) {
            dfs(v, x);
            ebuf.push_back(make_pair(x, v));
        } else {
            if (dep[v] > dep[x]) {
                ebuf.push_back(make_pair(x, v));
            }
        }
    }
}
vector<vector<int>> bbuf;
int ocnt;
int fa[N2];
inline int gf(int x) {
    while(x != fa[x])x = fa[x];
    return x;
}
void solve_set() {
    if (!ebuf.size()) {
        ocnt++;
		return;
    }
    ncnt = 0;
    for (pair<int, int> e : ebuf) {
        nums[++ncnt] = e.first;
        nums[++ncnt] = e.second;
    }
    sort(nums + 1, nums + 1 + ncnt);
    ncnt = unique(nums + 1, nums + 1 + ncnt) - nums - 1;
    for (pair<int, int> &e : ebuf) {
        e.first = lower_bound(nums + 1, nums + 1 + ncnt, e.first) - nums;
        e.second = lower_bound(nums + 1, nums + 1 + ncnt, e.second) - nums;
    }
	vector<int> buf(ncnt + 1);
    int lcnt = 0;
    for (int S = 0; S < (1 << ebuf.size()); S++) {
        int cnt;
        if(S & 1){
            cnt = lcnt;
            int xx = gf(ebuf[0].first),yy = gf(ebuf[0].second);
            if(xx != yy){
                fa[xx] = yy;
                cnt--;
            }
            lcnt = cnt;
        }else{
            for (int i = 1; i <= ncnt; i++) {
                fa[i] = i;
            }
            cnt = ncnt;
            for (int i = 0; i < ebuf.size(); i++) {
                int xx = gf(ebuf[i].first), yy = gf(ebuf[i].second);
                if ((S >> i) & 1) {
                    if (xx != yy) {
                        fa[xx] = yy;
                        cnt--;
                    }
                }
            }
            lcnt = cnt;
        }
        
        // cerr<<bitset<10>(S)<<' '<<cnt<<'\n';
        if (__builtin_popcount(S) & 1) {
            buf[cnt] = (buf[cnt] - 1 + MOD) % MOD;
        } else {
            buf[cnt] = (buf[cnt] + 1) % MOD;
        }
    }
	bbuf.push_back(buf);
}
void solve(int n, int m) {
    for (pair<int, int> e : edges) {
        int u, v;
        tie(u, v) = e;
        bian[u].push_back(v);
        bian[v].push_back(u);
    }
    for (int i = 1; i <= n; i++) {
        if (!vis[i]) {
            ebuf.clear();
            dfs(i, 0);
            solve_set();
        }
    }
}
int qpow(int x, int p) {
    int res = 1;
    while (p) {
        if (p & 1) {
            res = 1ll * res * x % MOD;
        }
        x = 1ll * x * x % MOD;
        p >>= 1;
    }
    return res;
}
int calc(int k) {
    int ans = qpow(k, ocnt);
	int ans1 = 1;
    for(vector<int> buf : bbuf){
		int ans2 = 0;
		int res = 1;
		for(int i = 1;i < buf.size();i++){
			res = 1ll*res*k%MOD;
			ans2 = (ans2 + 1ll*buf[i]*res%MOD)%MOD;
		}
		ans1 = 1ll*ans1*ans2%MOD;
	}
    return 1ll * ans * ans1 % MOD;
}
}  // namespace s2
namespace s3{
    const int N = 1e5+10;
    bool vis[N];
    int cnt = 0;
    vector<int> bian[N];
    vector<pair<int,int>> pl;
    void dfs(int x,int fa){
        vis[x] = 1;
        cnt++;
        for(int v: bian[x]){
            if(!vis[v]){
                dfs(v,x);
            }
        }
    }
    void solve(int n,int m){
        vector<int> rl;
        for(pair<int,int> e : edges){
            int u,v;
            tie(u,v) = e;
            bian[u].push_back(v);
            bian[v].push_back(u);
        }
        for(int i = 1;i<=n;i++){
            if(!vis[i]){
                cnt = 0;
                dfs(i,0);
                rl.push_back(cnt);        
            }
        }
        sort(rl.begin(),rl.end());
        for(int i = 0;i < rl.size();i++)
        {
            if(!pl.size() || pl.back().first != rl[i]){
                pl.push_back(make_pair(rl[i],1));
            }else{
                pl.back().second++;
            }
        }
    }

    int calc(int k){
        int ans = 1;
        for(pair<int,int> pai : pl){
            int len,cnt;
            tie(len,cnt) = pai;
            if(len == 1){
                ans = 1ll*ans*qpow(k,cnt)%MOD;
            }else{
                int bf;
                bf = qpow(k - 1,len);
                if(len % 2){
                    bf = (bf + MOD - (k - 1))%MOD;
                }else{
                    bf = (bf + (k - 1))%MOD;
                }
                ans = 1ll*ans*qpow(bf,cnt)%MOD;
            }
        }
        return ans;
    }
}
int main() {
    int n, m, c;
    cin >> n >> m >> c;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        edges.push_back(make_pair(u, v));
    }
    if (n <= 15) {
        s1::solve(n, m);
        for (int i = 1; i <= c; i++) {
            int x;
            cin >> x;
            cout << s1::calc(n, x) << '\n';
        }
    } else if (m <= 24) {
        s2::solve(n, m);
		//assert(0);
        for (int i = 1; i <= c; i++) {
            int x;
            cin >> x;
            cout << s2::calc(x) << '\n';
        }
    } else {
<<<<<<< HEAD
        s3::solve(n,m);
        for(int i = 1;i <= c;i++)
        {
            int x;
            cin>>x;
            cout<<s3::calc(x)<<'\n';
        }
=======
        
>>>>>>> 6c09441c7ca04be404b90d20bfcfe8cfde817d43
    }
}
namespace s2{
	const int N = 1e5+10;
	const int N2 = 48;
	int nums[N2],ncnt;
	bool vis[N];
	int dep[N];
	vector<int> bian[N];
	vector<pair<int,int>> ebuf;
	void dfs(int x,int fa){
		vis[x] = 1;
		dep[x] = dep[fa] + 1;
		for(int v : bian[x]){
			if(!vis[v]){
				dfs(v,x);
				ebuf.push_back(make_pair(x,v));
			}else{
				if(dep[v] > dep[x]){
					ebuf.push_back(make_pair(x,v));
				}
			}
		}
	}
	int mbuf;
	int buf[N2];
	int ocnt;
	int fa[N2];
	int gf(int x){
		if(x == fa[x]){
			return x;
		}
		return fa[x] = gf(fa[x]);
	}
	void solve_set(){
		if(!ebuf.size()){
			ocnt++;
		}
		ncnt = 0;
		for(pair<int,int> e : ebuf){
			nums[++ncnt] = e.first;
			nums[++ncnt] = e.second;
		}
		sort(nums + 1,nums + 1 + ncnt);
		ncnt = unique(nums + 1,nums + 1 + ncnt) - nums - 1;
		for(pair<int,int> e: ebuf){
			e.first = lower_bound(nums + 1,nums + 1 + ncnt,e.first) - nums;
			e.second = lower_bound(nums + 1,nums + 1 + ncnt,e.second) - nums;
		}
		mbuf = max(mbuf,ncnt);
		for(int S = 0;S < (1<<ebuf.size());S++){
			for(int i = 1;i<=ncnt;i++){
				fa[i] = i;
			}
			int cnt = ncnt;
			for(int i = 0;i < ebuf.size();i++){
				int xx = gf(ebuf[i].first),yy = gf(ebuf[i].second);
				if((S>>i)&1){
					if(xx != yy){
						fa[xx] = yy;
						cnt--;
					}
				}
			}
			//cerr<<bitset<10>(S)<<' '<<cnt<<'\n';
			if(__builtin_popcount(S) & 1){
				buf[cnt] = (buf[cnt] - 1 + MOD)%MOD;
			}else{
				buf[cnt] = (buf[cnt] + 1)%MOD;
			}
		}
	}
	void solve(int n,int m)
	{
		for(pair<int,int> e : edges){
			int u,v;
			tie(u,v) = e;
			bian[u].push_back(v);
			bian[v].push_back(u);
		}
		for(int i = 1;i<=n;i++){
			if(!vis[i]){
				ebuf.clear();
				dfs(i,0);
				solve_set();
			}
		}
	}
	int qpow(int x,int p){
		int res = 1;
		while(p){
			if(p & 1){
				res = 1ll*res*x%MOD;
			}
			x = 1ll*x*x%MOD;
			p>>= 1;
		}
		return res;
	}
	int calc(int k){
		int ans = qpow(k,ocnt);
		int res = 1;
		int a1 = 0;
		for(int i = 1;i<=mbuf;i++){
			res = 1ll*res*k%MOD;
			a1 = (a1 + 1ll*buf[i]*res%MOD)%MOD;
		}
		return 1ll*ans*a1%MOD;
	}
}
int main(){
	int n,m,c;
	cin>>n>>m>>c;
	for(int i = 1;i<=m;i++){
		int u,v;
		cin>>u>>v;
		edges.push_back(make_pair(u,v));
	}
	if(n <= 12){
		s1::solve(n,m);
		for(int i = 1;i <= c;i++){
			int x;
			cin>>x;
			cout<<s1::calc(n,x)<<'\n';
		}
	}else if(m <= 24){
		s2::solve(n,m);
		for(int i = 1;i<=c;i++){
			int x;
			cin>>x;
			cout<<s2::calc(x)<<'\n';
		}
	}else{

	}
}
/*
3 4
2 3
1 2
1 3
*/
